-
Notifications
You must be signed in to change notification settings - Fork 123
Cleanup: Connection cancel -> shutdown #404
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
return connection.execute(request: request) | ||
case .http2(let connection): | ||
return connection.executeRequest(request) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's some mildly irritating asymmetry :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
case .__testOnly_connection: | ||
break | ||
} | ||
} | ||
|
||
fileprivate func cancel() { | ||
/// Closes the connection without cancelling running requests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens to the requests if we don't cancel them? Why would do use this over shutdown?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the pool state machine, we know if a connection is idle or not. For this reason, we can use the direct way to close, if we are sure nothing is running on the connection.
Motivation
Modifications
cancel
connection toshutdown
, with an explicit code comment.http1_1
and.http2
cases toHTTPConnectionPool.Connection